/**
 * Copyright (c) 2000-2013 Liferay, Inc. All rights reserved.
 *
 * This library is free software; you can redistribute it and/or modify it under
 * the terms of the GNU Lesser General Public License as published by the Free
 * Software Foundation; either version 2.1 of the License, or (at your option)
 * any later version.
 *
 * This library is distributed in the hope that it will be useful, but WITHOUT
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
 * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
 * details.
 */

package de.hsmannheim.pepa.patientenportal.apanwep.model.impl;

import com.liferay.portal.kernel.util.StringBundler;
import com.liferay.portal.kernel.util.StringPool;
import com.liferay.portal.model.CacheModel;

import de.hsmannheim.pepa.patientenportal.apanwep.model.participants;

import java.io.Externalizable;
import java.io.IOException;
import java.io.ObjectInput;
import java.io.ObjectOutput;

/**
 * The cache model class for representing participants in entity cache.
 *
 * @author Cedric Nana
 * @see participants
 * @generated
 */
public class participantsCacheModel implements CacheModel<participants>,
	Externalizable {
	@Override
	public String toString() {
		StringBundler sb = new StringBundler(7);

		sb.append("{ID=");
		sb.append(ID);
		sb.append(", Userid=");
		sb.append(Userid);
		sb.append(", Username=");
		sb.append(Username);
		sb.append("}");

		return sb.toString();
	}

	@Override
	public participants toEntityModel() {
		participantsImpl participantsImpl = new participantsImpl();

		participantsImpl.setID(ID);

		if (Userid == null) {
			participantsImpl.setUserid(StringPool.BLANK);
		}
		else {
			participantsImpl.setUserid(Userid);
		}

		if (Username == null) {
			participantsImpl.setUsername(StringPool.BLANK);
		}
		else {
			participantsImpl.setUsername(Username);
		}

		participantsImpl.resetOriginalValues();

		return participantsImpl;
	}

	@Override
	public void readExternal(ObjectInput objectInput) throws IOException {
		ID = objectInput.readLong();
		Userid = objectInput.readUTF();
		Username = objectInput.readUTF();
	}

	@Override
	public void writeExternal(ObjectOutput objectOutput)
		throws IOException {
		objectOutput.writeLong(ID);

		if (Userid == null) {
			objectOutput.writeUTF(StringPool.BLANK);
		}
		else {
			objectOutput.writeUTF(Userid);
		}

		if (Username == null) {
			objectOutput.writeUTF(StringPool.BLANK);
		}
		else {
			objectOutput.writeUTF(Username);
		}
	}

	public long ID;
	public String Userid;
	public String Username;
}